/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package agents.factory;

import BESA.ExceptionBESA;
import BESA.Kernell.System.Directory.AgHandlerBESA;
import agents.communitymanager.CMA_SynchronousComm;
import agents.communitymanager.CMA_SynchronousCommState;
import co.edu.javeriana.ayllu.agents.factoryagent.FactoryAgentState;
import co.edu.javeriana.ayllu.data.Ayllu_Data_Message;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Ayllu
 */
public class ChatFactoryAgentState extends FactoryAgentState {

    private CMA_SynchronousCommState estado;
    private CMA_SynchronousComm cmaChat;

    @Override
    public AgHandlerBESA getCMAAgent(Ayllu_Data_Message theData) {
        AgHandlerBESA cmaHand = null;
        try {
            cmaHand = cmaChat.getAdmLocal().getHandlerByAid(cmaChat.getAid());
        } catch (ExceptionBESA ex) {
            Logger.getLogger(ChatFactoryAgentState.class.getName()).log(Level.SEVERE, null, ex);
        }
        return cmaHand;
    }
    


    public CMA_SynchronousCommState createCMAstate(AgHandlerBESA replyHandler, Class guardToReply, List<AgHandlerBESA> smaList) {
        this.estado=new CMA_SynchronousCommState(replyHandler,guardToReply,smaList);
        return this.estado;
    }
}
